package com.goldsprite.gameframeworks.ecs.system;

import com.goldsprite.gameframeworks.ecs.component.IComponent;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface GameSystemInfo {
	Class<? extends IComponent>[] interestComponents() default {};
	SystemType type() default SystemType.UPDATE;

	enum SystemType {
		UPDATE,
		FIXED_UPDATE,
		BOTH;

		public boolean has(SystemType systemType) {
			// BOTH 包含所有类型
			if (this == BOTH) {
				return true;
			}
			// 相同类型返回 true
			if (this == systemType) {
				return true;
			}
			// UPDATE 和 FIXED_UPDATE 互不包含
			return false;
		}
	}
}
